{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 导入moranI模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from MoranI import moranI\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 测试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'I': {'value': 0.4583333333333333, 'desc': '全局moran指数'}, 'ZI_N': {'value': 2.5944877065862784, 'desc': '正太分布假设下检验数'}, 'ZI_R': {'value': 2.2860533202446978, 'desc': '随机分布假设下检验数'}, 'Ii': {'value': array([0.41666667, 0.24305556, 0.24305556, 0.97222222, 0.41666667]), 'desc': '局部moran指数'}, 'ZIi': {'value': array([-0.15523011, -0.80202221, -0.80202221,  1.91450463, -0.15523011]), 'desc': '局部检验数'}, 'img': {'path': 'D:\\\\桌面\\\\PythonFunctions\\\\MoranI\\\\莫兰散点图.png', 'desc': '莫兰散点图路径'}}\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAADuCAYAAAAOR30qAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XlcVGXfP/DPAIOASgIK7uCOgAuLCqmAKCBypkdzvW98NElBRCy1J1NTSSVyydt6LG2e5C5zo9QnAxQxE5dEUVAJUXJDJCUQBgTZZrl+f/Qwv3BlmZlzZvi+Xy9frxjOnPOdyE8X33Ou6xIxxkAIIYR/RnwXQAgh5C8UyIQQIhAUyIQQIhAUyIQQIhAUyIQQIhAUyIQQIhAUyIQQIhAUyIQQIhAUyIQQIhAmTTyepvURQRo/fjySk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+9ZCVSiU+//xzuLi4YO7cuVAqlTAxMaEwJoS0GoII5Bs3bsDb2xvvvPMOvL29ceLECRgbG/NdFiGE6BTvN/Vu3LiBoUOHom3btti1axdmzpxJT1AQQlol3gJZJpPBysoKAwYMwLp16zBr1izY2dnxVQ4hhPBO5y2LmpoarFixAg4ODrh9+zZEIhH+67/+i8KYNFBaWorjx4/j0aNHfJdCiM7oNJDPnTsHV1dXxMbG4s0334S1tbUuL0/0hEwmA8dxSE9Px5gxY1BcXMx3SYTohE5aFowxLFmyBJ999hl69uyJY8eOISAgQBeXJnooKysLW7ZsgaenJ2QyGTIzMxEYGMh3WYRonU5GyCKRCEqlEgsXLkR2djaFMXkpHx8feHp64vTp00hPT4eXl9dzj5NKpfDw8ICHhweNoolB0NnEEFoMiLxIeHg4cnNz1V/7+flh1apVWLhwIQoKCrB//36Ym5u/9Bw0MYQIXKPCT3Az9Qj5u1WrVsHFxQXTp09/6XEUyETg9GumHiH1NmzYgF27dgEAysrK0KFDB54rIkQ3KJCJ4ISFheG7776Dt7c3lEol3XMgrQbvM/UIeZqVlRWOHz/OdxmE6ByNkAkhRCAokAkhRCAokAkhRCAokAkhRCCa+hwyIYIkEomSGWPj+a6DkJagQCaEEIGglgUhhAgEBTIhhAgEBTIhhAgEBTIhhAgEBTIhhAgEBTIhhAgEBTIhhAgEBTIhhAgEBTIhhAjE/wMNdfm8StIUaAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#权重矩阵,函数会在内部进行标准化\n",
    "w = [\n",
    "     [0,1,1,0,0],\n",
    "     [1,0,1,1,0],\n",
    "     [1,1,0,1,0],\n",
    "     [0,1,1,0,1],\n",
    "     [0,0,0,1,0]\n",
    "    ]\n",
    "w = np.array(w)\n",
    "#观测值矩阵\n",
    "x = [[8,6,6,3,2]]\n",
    "x = np.array(x)\n",
    "print(moranI(w,x))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
